function myready() {
	changeh(document.documentElement.scrollHeight+500);
	$(".page").click(function() {
		if ($(this).attr('v') == 'warn') {
			window.location.href = "libset.php?xtype=show"
		} else {
			window.location.href = "libset.php?xtype=auto"
		}
		return false;
	});
	$(".game").change(function() {
		window.location.href = "libset.php?xtype=show&gid=" + $(".game").val()
	});
	$("label").addClass('red');
	$("input:text").addClass('txt1');
	$(".send").click(function() {
		var str = '{';
		var i = 0;
		var err = false;
		$(".nr").each(function() {
			var je = $(this).find(".je").val();
			var ks = $(this).find(".ks").val();
			var ftype = $(this).attr('f');
			if (i > 0) str += ',';
			str += '"' + i + '":{"je":"' + je + '","ks":"' + ks + '","ftype":"' + ftype + '"}';
			if (je % 1 != 0) err = true;
			if (ks % 1 != 0) err = true;
			i++
		});
		str += '}';
		if (err) {
			alert("请输入整数！");
			return false
		}
		var gid = $(".game").val();
		str = '&str=' + str + '&gid=' + gid;
		$.ajax({
			type: 'POST',
			url: 'libset.php',
			data: 'xtype=setwarn' + str,
			success: function(m) {
				if (Number(m) == 1) {
					alert("修改成功");
					window.location.href = window.location.href
				}
			}
		})
	})
			$(".yiwotongbu").click(function(){
		if(!confirm("确定以我同步吗？"))	return false;
		var gid =$(this).attr('gid');
        $.ajax({
            type: 'POST',
            url: 'libset.php',
            data: 'xtype=yiwotongbuwarn&gid='+gid,
            success: function(m) {
				
                if (Number(m) == 1) {
                    alert("同步成功");
                    window.location.href = window.location.href;
                }
            }
        });  
	});
	
	$("input.all").click(function(){
	    if($(this).prop("checked")){
		    $("tr").find("input:checkbox:eq(0)").attr("checked",true);
		}else{
		    $("tr").find("input:checkbox:eq(0)").attr("checked",false);
		}
	});
	
	$("input.pantb").click(function(){
	    $(this).parent().parent().find("input:text").each(function(i){
			 var val = $(this).val();
		     $("tr").each(function(){
			     if($(this).find("input:checkbox:eq(0)").prop("checked")){
			         $(this).find("input:text:eq("+i+")").val(val);
				 }
			 });
		});

		
	});
}